<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        ul li{
            list-style: none;
        }
        .item{
            width: 100px;
            height: 40px;
            background-color: #ffc0cb;
            border: 1px solid #ffa500;
            text-align: center;
            line-height: 40px;
            float: left;
        }
        /*第一种*/
        /* .clearfix{   
            clear: both;
        } */
        .list::after{    /*第二种*/
            content: '';
            display: block;
            clear: both;
        } 
    </style>
</head>
<body>
    <ul class="list">
        <li class="item">1</li>
        <li class="item">2</li>
        <li class="item">3</li>
        <li class="item">4</li>
        <li class="item">5</li>
        <!-- <div class="clearfix"></div> -->
    </ul>
    <div class="test">
        hello world!
    </div>
</body>
</html>